<template>
    <div class="order-report">
        <div class="report-table-top-title">
            增值服务列表
        </div>
        <div class="report-table-form1">
            <div class="report-table-form1-line">
                <div
                    class="report-table-form1-item word samll"
                    style="width: 200px"
                >商家编号：{{this.companyCode}}</div>
                <div
                    class="report-table-form1-item word samll"
                    style="width: 250px"
                >商家名称：{{this.companyName}}</div>
                <el-button type="primary" size="small" @click="toMain">返回</el-button>
            </div>
        </div>
        <div class="report-table-wrapper">
            <el-table
                :header-cell-style="headerCellStyle"
                size="small"
                :data="addservicecompanylist"
                border
                style="width: 100%"
            >
                <el-table-column prop="addServiceCode" label="增值服务编码" width="200">
                    <template slot-scope="props">
                        <div>{{props.row.addServiceCode}}</div>
                    </template>
                </el-table-column>
                <el-table-column prop="addServiceName" label="增值服务名称" width="200">
                    <template slot-scope="props">
                        <div>{{props.row.addServiceName}}</div>
                    </template>
                </el-table-column>
                <el-table-column prop="addServiceType" label="增值服务类型" width="200">
                    <template slot-scope="props">
                       <div v-show="props.row.addServiceType===1">卡台数段位</div>
                       <div v-show="props.row.addServiceType===2">数据可查时长</div>
                       <div v-show="props.row.addServiceType===3">霸屏</div>
                       <div v-show="props.row.addServiceType===4">小程序</div>
                       <div v-show="props.row.addServiceType===5">连锁会员</div>
                    </template>
                </el-table-column>
                <el-table-column prop="effectiveTime" label="授权生效时间" width="200">
                    <template slot-scope="props">
                        <div v-if="props.row.addServiceType===1">不限</div>
                        <div v-else>{{$F(props.row.effectiveTime)}}</div>
                    </template>
                </el-table-column>
                <el-table-column prop="expiredTime" label="授权到期时间" width="200">
                    <template slot-scope="props">
                        <div v-if="props.row.addServiceType===1">不限</div>
                        <div v-else>{{$F(props.row.expiredTime)}}</div>
                    </template>
                </el-table-column>
            </el-table>
        </div>

        <div class="report-table-block">
            <div class="report-table-block-in">
                <el-pagination
                    background
                    :current-page.sync="position"
                    @current-change="handleCurrentChange"
                    :page-size="10"
                    layout="prev, pager, next, total"
                    :total="totalNum"
                ></el-pagination>
            </div>
        </div>

        <div class="page-padding"></div>
    </div>
</template>

<script type="text/ecmascript-6">
export default {
    data: function () {
        return {
            timeStart: '',
            timeEnd: '',

            companyCode: '',
            companyList: [],

            nowPage: 0, // 当前所在页面

            showList: [],
            addservicecompanylist: [],

            totalNum: 0,
            position: 1, // 页码

            searchNo: '',
            searchName: '',
            companyName: ''
        }
    },
    mounted () {
    },
    created () {
        this.companyCode = this.companyCodeOut
        this.getPage()
    },
    watch: {
        position () {
            this.getPage()
        }
    },
    components: {
    },
    props: {
        underLine: null
    },
    computed: {
        companyCodeOut () {
            return this.$store.state.page1KTVAgentService
        }
    },
    methods: {

        toMain () {
            this.$store.dispatch('setKA', 0)
        },

        getPage () {
            this.$http.post(this.$store.state.IP + '/system/company/page', {
                data: {
                    page: this.position - 1, // 页数
                    limit: 10, // 一页显示数量
                    companyCode: this.companyCode,
                    companyName: ''
                }
            },
                {
                    'emulateJSON': false
                }
            ).then(response => {
                console.log('-------------------------------------------')
                response = response.body
                console.log(response)
                if (response.ret === '0') {
                    console.log('调用增值服务列表成功')
                    console.log(response.data)
                    this.showList = response.data.list
                    this.companyName = response.data.list[0].companyName
                    this.addservicecompanylist = response.data.list[0].addServiceCompanyList
                    this.totalNum = 1
                }
                if (response.ret !== '0') {
                    console.log('调用增值服务列表失败')
                }
                console.log('******************************************')
            }, response => {
                console.log('通讯失败')
            })
        },

        // 换页方法
        handleCurrentChange (val) {
            this.position = val
        }
    }
}
</script>

<style lang="stylus" rel="stylesheet/stylus">
.order-report
    width: 100%
    background #f1f0f5

    .report-table-top-title
        width: 100%
        height: 64px
        line-height: 64px
        color: #000
        font-size: 18px

     .report-table-form1
        width: 100%
        min-height: 40px
        padding: 16px 0 0 22px
        box-sizing border-box
        background #fff
        overflow hidden

        .report-table-form1-line
            min-height: 32px
            margin-bottom: 16px

            .report-table-form1-item
                display: inline-block
                vertical-align: top
                height: 32px
                margin-right: 15px
                line-height: 32px

                &.word
                    margin-right: 0

                &.samll
                    font-size: 15px
                    text-align left

                &.big
                    margin-right: 100px

    .report-table-block
        width: 100%
        padding-top: 22px
        height 50px
        background #fff
        box-sizing border-box

        .report-table-block-in
            float: right
            padding-right 17px

    .page-padding-gray-small
        width: 100%
        height: 22px
        background #f1f0f5
    .page-padding
        width: 100%
        height: 20px
        background #fff


    .report-table-total
        width: 100%
        font-size: 16px
        color #409EFF
        padding: 22px
        margin-top 22px
        box-sizing border-box
        background #fff
</style>
